#include "config.h"
#include "UART.h"
#include "IR.h"
/***************************************/
void Timer0Init(void)		//125us@22.1184MHz
{
	AUXR |= 0x80;		
	TMOD &= 0xF0;		
	TL0 = 0x33;		
	TH0 = 0xF5;		
	TF0 = 0;		
	TR0 = 1;		
	PT0 = 1;	      
	ET0=1;
	Timer0_Priority(Priority_0);//Priority_0,Priority_1,Priority_2,Priority_3.
}
/***************   *****************/
void	UART_config(void)
{
	COMx_InitDefine		COMx_InitStructure;					
	COMx_InitStructure.UART_Mode      = UART_8bit_BRTx;		
	COMx_InitStructure.UART_BRT_Use   = BRT_Timer1;			
	COMx_InitStructure.UART_BaudRate  = 115200ul;			
	COMx_InitStructure.UART_RxEnable  = ENABLE;				
	COMx_InitStructure.BaudRateDouble = DISABLE;			
	COMx_InitStructure.UART_Interrupt = ENABLE;				
	COMx_InitStructure.UART_Priority    = Priority_0;		
	COMx_InitStructure.UART_P_SW      = UART1_SW_P30_P31;	
	UART_Configuration(UART1, &COMx_InitStructure);		

}
void main()
{

 Timer0Init();
 UART_config();
 IRInit();
 EA=1;	
 printf("ir io isr \r\n");
 printf("IR pin=%bd\r\n",IR_PIN);
 while(1)
 {
	 IR_Printf();
	
 }	 
}	
/***********************/ 
void tm0_isr() interrupt 1	  //125us
{
 IR_timer();	
}
